Passed
Push — 1 ( f8e5cb...ba63b3 )
by Robbie
03:44
created

applyConditionals.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 21
rs 9.3142
c 1
b 0
f 0
cc 1
nc 1
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A applyConditionals.js ➔ ... ➔ ??? 0 16 1
1
import Injector from 'lib/Injector';
2
3
const applyConditionals = () => {
4
  Injector.transform(
5
    'add-to-campaign',
6
    (updater) => {
7
      updater.form.alterSchema(
8
        '*.AddToCampaign',
9
        (form) => {
10
          const toggle = form.getFieldByName('AddNewSelect');
11
          if (!toggle) {
12
            return form.getState();
13
          }
14
          const visible = form.getValue('AddNewSelect');
15
          return form
16
            .setFieldClass('NewTitle', 'show', visible)
17
            .setFieldClass('NewTitle', 'hide', !visible)
18
            .getState();
19
        }
20
      );
21
    }
22
  );
23
};
24
25
export default applyConditionals;
26